@extends('layouts.frontend-iframe-base')


@section('css')
@stop

@section('content')
        <!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        实时监测
        <small>设备列表</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li class="active">首页</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">

    <!-- Your Page Content Here -->
    <div class="box">
        <div class="box-header">
            <h3 class="box-title">我的设备</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <table id="J-dt" class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th>状态</th>
                    <th>设备ID</th>
                    <th>名称</th>
                    <th>S/N</th>
                    <th>所属分组</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
        <!-- /.box-body -->
    </div>
    <!-- /.box -->


</section>
<!-- /.content -->


@stop

@section('js')
    <script>

        $(function () {
            $('#J-dt').DataTable({
                "paging": true,
                "lengthChange": false,
                "searching": true,
                "ordering": true,
                "info": true,
                "autoWidth": false,
                "ajax": {
                    "url": "/frontend/device/devices",
                    "type": "get"
                },
                "columns": [
                    {"data": "status", "defaultContent": "未知"},
                    {"data": "device_id"},
                    {"data": "name"},
                    {"data": "sn"},
                    {"data": "group.name", "defaultContent": "暂无分组"},
                    {"data": "id"}
                ],
                "columnDefs": [
                    {
                        "targets": -1,
                        "render": function (data, type, row) {
                            return '<a href="/frontend/device/detail?id=' + data + '" class="btn btn-success btn-sm J-del-btn" data-id="' + data + '"><i class="fa fa-bar-chart-o"></i></a>';
                        }
                    }


                ]
            });


        });


    </script>
@stop